#!/usr/bin/python3
# author luke
# 2024年03月06日下午 1:05


class Solution(object):
    def numberOfSteps(self, num):
        cnt = 0
        while num:
            if num % 2 == 0:
                num = num / 2

            elif num % 2 != 0:
                num -= 1
            cnt += 1
        return cnt


if __name__ == '__main__':
    # num = 14
    # num=8
    num=123
    sou = Solution()
    print(sou.numberOfSteps(num))
